import { defineStore } from 'pinia';
import { store } from '@/store';

export interface IUserContextState {
  uniqueStr: string;
}

export const useUserContextStore = defineStore({
  id: 'app-user-context',
  state: (): IUserContextState => ({
    uniqueStr: '',
  }),
  getters: {
    getUniqueStr(): string {
      return this.uniqueStr;
    },
  },
  actions: {
    setUniqueStr(uniqueStr: string) {
      this.uniqueStr = uniqueStr;
    },
    clearUniqueStr() {
      this.uniqueStr = '';
    },
  },
});

// Need to be used outside the setup
export function useUserContext() {
  return useUserContextStore(store);
}